<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
<head th:include="common/common.html::common_css">
</head>
<script>
    function getHref(obj) {
        var a = document.getElementById("btn");
        a.href = obj.href;
    }
</script>
<body>
<div th:replace="common/admin_common.html::common_sidebar"></div>
<div class="page">
    <div th:replace="common/admin_common.html::common_navbar"></div>
    <!-- Breadcrumb-->
    <div class="breadcrumb-holder">
        <div class="container-fluid">
            <ul class="breadcrumb">
                <li class="breadcrumb-item"><a th:href="@{/admin/admin_index.html}">主页</a></li>
                <li class="breadcrumb-item active">部门管理</li>
            </ul>
        </div>
    </div>
    <section>
        <div class="container-fluid">
            <!-- Page Header-->
            <header>
                <h1 class="h3 display">部 门</h1>
            </header>
            <div class="row">
                <div class="col-lg-6" style="flex:100%;max-width: 100%">
                    <div class="card">
                        <div class="card-header">
                            <h4>部 门</h4>
                            <div style="width: 100%;height: 100%;text-align: center">
                                <a id="add" th:href="@{/admin/apartment_add.html}" class="btn btn-secondary m-b-10 m-1-5"
                                   style="border-radius: 4px" type="button">添加部门</a>
                            </div>
                        </div>
                        <div class="card-body">
                            <div class="table-responsive">
                                <table class="table">
                                    <thead style="text-align: center">
                                    <tr>
                                        <th>部门编号</th>
                                        <th>部门名称</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody style="text-align: center">
                                    <tr th:each="apartment:${apartmentsList}">
                                        <td th:text="${apartment.apartmentid}"></td>
                                        <td th:text="${apartment.apartmentname}"></td>
                                        <td>
                                            <a id="update"
                                               th:href="@{/admin/apartment_update.html/{id}(id=${apartment.apartmentid})}"
                                               class="btn btn-warning m-b-10 m-1-5" style="border-radius: 4px"
                                               type="button">修改</a>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                               </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <div th:replace="common/common.html::common_footer"></div>
</div>
<div th:replace="common/common.html::common_js">
</div>
</body>
</html>